/*
 * @(#)User.java 2009-2-19
 * Copyright (c) 2008-2015 by CJK
 * All rights reserved.
 */
package net.beyond.core.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import net.beyond.common.BaseEntity;

/**
 * �û�
 * 
 * @author Shmiluyu
 * @version 1.000 2009-2-19
 */
public class User extends BaseEntity {

	private static final long serialVersionUID = 1L;
	// �û���
	private String username;
	// ����
	private String password;
	/** 在action中使用，验证两次密码输入是否一致 */
	private String password2;
	private String email;
	private String qq;
	// �Ƿ�����
	private boolean enabled = true;
	private Date createTime;
	private String nickName;
	// ���һ�ε�½��IP
	private String lastLoginIp;
	private Set<Role> roles;

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getQq() {
		return qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	public boolean isEnabled() {
		return enabled;
	}

	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getLastLoginIp() {
		return lastLoginIp;
	}

	public void setLastLoginIp(String lastLoginIp) {
		this.lastLoginIp = lastLoginIp;
	}

	public Set<Role> getRoles() {
		return roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

	public User addRole(Role role) {
		if (getRoles() == null) {
			setRoles(new HashSet<Role>());
		}
		getRoles().add(role);
		return this;
	}

	public String getPassword2() {
		return password2;
	}

	public void setPassword2(String password2) {
		this.password2 = password2;
	}
}
